home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / lib / kde4 / libexec / kdeeject < prev    next >
Encoding:
Text File  |  2008-01-04  |  993 b   |  38 lines

  1. #!/bin/sh
  2. # Script used by kdesktop to eject a removable media (CDROM/Tape/SCSI/Floppy)
  3. # Relies on the 'eject' program, 'cdcontrol' on *BSD
  4. #
  5. # Copyright GPL v2 by David Faure <david@mandrakesoft.com>
  6. #
  7. if test $# -ge 1 -a "$1" != "--help"; then
  8.   quiet=0
  9.   if test "$1" = "-q"; then
  10.     quiet=1
  11.     shift
  12.   fi
  13.   # Checking for stuff in the PATH is ugly with sh.
  14.   # I guess this is the reason for making this a kde app...
  15.   OS=`uname -s`
  16.   case "$OS" in
  17.     OpenBSD)
  18.       cdio -f $1 eject >/dev/null 2>&1
  19.       ;;
  20.     *BSD)
  21.       dev=`echo $1 | sed -E -e 's#/dev/##' -e 's/([0-9])./\1/'`
  22.       cdcontrol -f $dev eject >/dev/null 2>&1
  23.       ;;
  24.     *)
  25.       eject $1 >/dev/null 2>&1
  26.       ;;
  27.   esac
  28.   if test $? -eq 0; then
  29.     qdbus org.kde.kdesktop /Desktop refreshIcons
  30.     exit 0
  31.   elif test $quiet -eq 0; then
  32.     kdialog --title "KDE Eject" --error "Eject $1 failed!"
  33.   fi
  34. else
  35.   kdialog --title "KDE Eject" --msgbox "Usage: $0 <name> where name is a device or a mountpoint."
  36. fi
  37. exit 1
  38.